<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="utf-8"/>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=Edge">
    <meta name="viewport" content="target-densitydpi=640,width=1280,user-scalable=yes">
    <base href="<?php echo $system['siteRoot'];?>" />
    <title>确认订单</title>
    <?php import_tpl("fragment/icon.php"); ?>
    <link rel="stylesheet" href="plugin/reset.css"/>
    <link rel="stylesheet" href="plugin/awesome4/css/font-awesome.min.css"/>
    <link rel="stylesheet" href="style/common.css"/>
    <link rel="stylesheet" href="style/putuan-order.css?v=0.1"/>
    <style type="text/css">
        /*div.order-pay*/
        div.pay-way{
            margin-left: 50px;
        }
        div.pay-way p{
            margin: 30px 0;
        }
        div.pay-way p b{
            color: #df003c;
        }
        div.pay-way div.rest-pay-captcha{
            display: block;
            margin: 10px 15px;
        }
        div.pay-way div.rest-pay-captcha input{
            padding: 0 10px;
            width: 150px;
            height: 35px;
            line-height: 35px;
            font-size: 13px;
            border: 1px solid #cbcbcb;
            border-radius: 5px;
        }
        div.pay-way div.rest-pay-captcha i {
            display: inline-block;
            margin: 0 10px 0 4px;
            color: #05c732;
        }
        div.pay-way div.rest-pay-captcha a{
            display: inline-block;
            padding: 0 9px;
            font-size: 15px;
            line-height: 35px;
            color: #fff;
            border-radius: 5px;
            background-color: #ffa801;
        }
        div.order-pay a.info-affirm {
            cursor: pointer;
            display: ;
            display: inline-block;
            margin-left: 35%;
            margin-top: 30px;
            padding: 10px 80px;
            border: none;
            color: #fff;
            background-color: #32b16c;
        }
        div.pay-way  label img{
            width: 224px;
            height: 72px;
        }
    </style>
    <style type="text/css">
        .hidden-place-box{
            overflow: hidden;
            height: 100px;

        }
        #show-more-place{
            display: none;
            padding: 5px;
            border-radius: 5px;
        }
    </style>
    <script src="plugin/jquery-1.11.2.min.js"></script>
    <script type="text/javascript">_root='<?php echo $system['siteRoot'];?>'</script>
    <script type="text/javascript" src="http://api.map.baidu.com/api?v=2.0&ak=HNtF8PpKdoLMQTDurEuZUVTE"></script>
    <style>
        #allmap{width:700px;height:450px;}
    </style>
    <script src="script/api.js"></script>
    <script type="text/javascript">
        // 商家信息
        var _shopList = [
        <?php foreach ($r['order'] as $v) {
            echo "'".$v['shop']['company']."',";
        }?>
        ]
    </script>
</head>
<?php 
//var_dump($r);
?>
<body>
<div id="container" class="index">
    <?php import_part("custom.home","userBar"); ?>
    <?php import_part("custom.home","header"); ?>
    <?php import_tpl("fragment/nav.php"); ?>
    <div class="main-container">
        <form method="POST" action="<?php e_page("order","confirmSubmit");?>" >
            <input type="hidden" name="confirmType" value="<?=$r['confirmType']?>">
            <div class="order-info">
                <h1><i class="fa fa-file"></i>确认订单</h1>
                <h2>核对订单</h2>
                <div class="order-choice">
                    <div class="order-name">商品名称</div>
                    <div class="order-goods-size">产品规格</div>
                    <div class="unit-price">单价（元）</div>
                    <div class="order-amount">数量</div>
                    <div class="order-rental">小计</div>
                    <div class="order-operation">选择分享人</div>
                </div>
                <?php $total=0.0;foreach ($r['order'] as $k => $v) {?>
                    <div class="order-plate">
                        <h1><?=$v['shop']['company']?><span>（商家信息）</span></h1>
                        <input name="shop[<?=$k?>][shop_id]" type="hidden" value="<?php echo $v['shop']['id'] ;?>">
                        <div class="order-goods">
                            <?php
                                $shop_order_amount = 0.0; 
                                foreach ($v['goods'] as $k2 => $v2) {
                                    //var_dump($v['goods']);
                                    $order_amount=$v2['real_price'] * $v2['number'];
                                    $total+=$order_amount;
                                    $shop_order_amount += $order_amount;
                            ?>
                                <input name="shop[<?=$k?>][goods][<?=$k2?>][gopen_id]" type="hidden" value="<?php echo $v2['gopen_id'];?>" />
                                <input name="shop[<?=$k?>][goods][<?=$k2?>][goods_id]" type="hidden" value="<?php echo $v2['goods_id'];?>" />
                                <div class="order-category">
                                    <div class="order-name"><a href="<?php e_page('goods','index',array('id'=>$v2['gopen_id'])) ?>"><?=$v2['name']?></a></div>
                                    <div class="order-goods-size">
                                        <?=$v2['attr_name']?>
                                        <input name="shop[<?=$k?>][goods][<?=$k2?>][attr_id]" type="hidden" value="<?php echo $v2['attr_id'];?>">
                                    </div>
                                    <div class="unit-price">¥ <?=$v2['real_price']?></div>
                                    <div class="order-amount">
                                        <?=$v2['number']?>
                                        <input name="shop[<?=$k?>][goods][<?=$k2?>][number]" type="hidden" value="<?php echo $v2['number'];?>">
                                    </div>
                                    <div class="order-rental">¥ <?=$order_amount?></div>
                                    <div class="order-operation">
                                        <select name="shop[<?=$k?>][goods][<?=$k2?>][share_id]">
                                            <?php if(!empty($v2['share'])){
                                                foreach ($v2['share'] as $k3=>$v3) {?>
                                                <option value="<?=$v3['from_id']?>" <?= $k3==0 ? 'selected':''?>><?=$v3['username']?></option>
                                            <?php } }else{?>
                                                <option value="" selected="selected">无</option>
                                            <?php }?>
                                        </select>
                                    </div>
                                </div>
                            <?php } ?>
                            <input name="shop[<?=$k?>][order_amount]"   value="<?=$shop_order_amount?>" type="hidden" />
                            <input name="shop[<?=$k?>][payment_amount]" value="<?=$shop_order_amount?>" type="hidden" />
                            <input name="shop[<?=$k?>][type]"           value="<?php echo $v['goods'][0]['type'];?>" type="hidden">
                        </div>
                    </div>
                <?php }?>
                <div class="order-total">
                    商品总价 <span><?=$total?></span> 元 + 运费 <span>0.00</span> 元 = 总价 <span class="freight-fee"><?=$total?></span>元
                </div>
                <input name="order_amount" type="hidden" value="<?php echo $total; ?>">
                <script type="text/javascript">
                //总价
                var _orderTotal = <?=$total?>
                </script>
                <div class="receive-address">
                    <h2>收货地址</h2>
                    <div class="places">
                        <div class="hidden-place-box">
                            <div class="old-places-box">
                                <label class="old-place">
                                    <input type="radio" name="user_address_id" class="js-addressId">
                                    <!--<span class="js-receive-name">张三</span>
                                    (<span class="js-receive-tel">18796222021</span>)-->
                                    <span class="js-receive-address">省XX市XX村XX组XX号</span>
                                </label>
                            </div>
                        </div>
                        <button id="show-more-place">显示更多地址</button>
                        <label class="new-place">使用新地址</label>
                    </div>
                    <div class="new-address">
                        <div class="consignee-info">
                            <span>*</span>
                            <label for="consignee-name">收货人姓名</label>
                            <input type="text" id="consignee-name">
                        </div>
                        <div class="consignee-info">
                            <span>*</span>
                            <label for="consignee-phone">收货人电话</label>
                            <input type="text" id="consignee-phone">
                        </div>
                        <div class="consignee-info">
                            <span>*</span>
                            <label for="consignee-province">收货人地址</label>
                            <div class="js-select-address-box" style="display:inline-block">
                                <select class="js-select-address"></select>    
                            </div>
                            <input type="text" id="consignee-address" placeholder="请填写补充详细地址">
                        </div>
                        <p>请注意产品的限购区域，如果邮寄到灵璧以外的产品请选择“其他区域”自己填写地址</p>
                        <a href="" class="truely-add">确认添加</a>
                    </div>
                    <div class="service-station">
                        <div class="choose-station">
                            <label for="station-address"><span class="station-choice">选择服务站</span>
                                <select id="station-address" name="service_id">
                                    <option value="0" selected>不通过服务站收货</option>
                                </select>
                            </label>
                        </div>
                        <div class="station-map">
                            <div id="allmap"></div>
                        </div>
                    </div>
                    <div class="order-note">
                        <h2>订单备注</h2>
                        <textarea name="remark" placeholder="请填写您是否还有其他需求，如送货时间等，在这里面用户可以填写一些想说的话"></textarea>
                    </div>
                    <div class="purchase-agent">
                        <p class="purchase-agent-title">购买方式
                            <label><input type="radio" name="purchase-method" checked  value="1" class="purchase-myself"  >我自己买</label>
                            <label><input type="radio" name="purchase-method"  value="2" class="purchase-agent" >我是代购<em>（代购赢奖金！）</em></label>
                        </p>
                        <div class="purchase-agent-phone">
                            <div class="get-code">
                                <label for="purchase-phone-number">实际购买人的手机号码</label>
                                <input name= "buyer_id" type="text" id="purchase-phone-number" placeholder="请输入实际购买人的手机号">
                                <a href="" class="agent-get-code">免费获取验证码</a>
                            </div>
                            <div class="confirm-code">
                                <label for="purchase-check-code">输入验证码</label>
                                <input type="text" id="purchase-check-code" placeholder="请输入验证码">
                                <a href="javascript:" class="agent-confirm-code">确认提交验证码</a>
                                <p class="code-error-info"></p>
                            </div> 
                        </div>                 
                    </div>
                    <div class="privilege">
                        <h2>优惠抵现</h2>
                        <div class="score-limit">
                            <label for="use-limit">使用积分额度</label>
                            <input type="text" id="use-limit" placeholder="请输入积分，1000积分抵1元" name="point">
                            (剩余可用积分共<span class="left-point">???</span>分 本次最多可用积分<span class="avilable-point">0</span> 该积分可抵用<span class="point-to-money">0</span>元)
                        </div>
                        <div class="pay-voucher">
                            <label for="pay-voucher-choose">选择支付券
                            </label>
                            <select name="user_coupon_id" id="pay-voucher-choose">
                                <option value="" selected="selected">不使用</option>
                            </select>
                        </div>
                    </div>
                    <div class="Pay-way">
                        <h2>支付方式</h2>
                        <div class="pay-way">
                            <p><input type="radio" id="rest-pay" name="pay_way" value="money" checked />
                                <label for="rest-pay">
                                    余额支付&nbsp;&nbsp;&nbsp;&nbsp;（
                                    <span style="display:none" class="js-pay-usermoney">账户余额<b>0</b>元</span>
                                    <span style="display:none" class="js-pay-leftpay">，余额支付<b>0</b>元</span>
                                    <span style="display:none" class="js-pay-alipay">，其余<b>0</b>元使用支付宝</span>
                                    <span style="display:none" class="js-pay-usermoneyleft">，交易后账户剩余<b>0</b>元</span>
                                    <span class="js-pay-loading"> 加载中 ... </span>
                                    ）
                                </label>
                            </p>
                            <input type="radio" id="alipay"  name="pay_way" value="alipay" />
                            <label for="alipay">
                                <img src="images/Pay.png" alt="">
                            </label>
                        </div>
                    </div>
                    <div class="order-total-submit">
                        <span>总计总额</span>
                        <input type="hidden" name="payment_amount" id="order-final-input" value="<?=$total?>" />
                        <span class="order-total-price">￥<b id="order-final-total"><?=$total?></b></span>
                        <input type="submit" id="confirm-button" value="确认支付" /> 
                    </div>
                </div>
            </div>
        </form>
    </div>
    <?php import_tpl("fragment/footer.php"); ?>
</div>
<div class="alert-bg mobile-code">
    <div class="alert-box">
        <a href="">免费获取验证码</a>
        <input type="text" placeholder="请输入您收到的验证码">
    </div>
</div>
<div class="alert-bg order-pay">
    <div class="alert-box">
        <form id="order-pay" action="<?php e_page('order','confirmSubmit') ?>" method="get">
            <input type="hidden" id="order-id" name="order_id" value="">
            <div class="alert-box-title">余额支付<a class="close" href="javascript:"><i class="fa fa-close"></i></a></div>
            <div class="pay-way">
                <p><input type="radio" id="pay-way-money" name="pay_way" value="money" checked>
                    <label for="pay-way-money" id="pay-way-money-label">余额支付&nbsp;&nbsp;&nbsp;&nbsp;<span>(账户余额元，余额支付元，其余元使用支付宝)</span></label></p>
                <div class="rest-pay-captcha">
                    <label for="test-code">验证码</label>
                    <input name="code" type="text" id="test-code" placeholder="请输入验证码">
                    <i class="fa fa-check-circle code-right" style="display:none;"></i><i class="fa fa-times-circle code-wrong" style="color:red;"></i>
                    <a href="javascript:" class="getCodeButton">免费获取验证码</a>
                </div>
                <!--
                <input type="radio" id="alipay"  name="pay_way" value="alipay">
                <label for="alipay">
                    <img src="images/Pay.png" alt="">
                </label>-->
            </div>
            <a href="javascript:" class="info-affirm">确认</a>
        </form>
    </div>
</div>
<script src="script/order-confirm.js?v=2"></script>
<script src="script/address.js?v=2"></script>
</body>
</html>